package ehsm

const (
	InitializeAction                      Action = 0
	FinalizeAction                        Action = 1
	CreateKeyAction                       Action = 2
	EncryptAction                         Action = 3
	DecryptAction                         Action = 4
	AsymmetricEncryptAction               Action = 5
	AsymmetricDecryptAction               Action = 6
	SignAction                            Action = 7
	VerifyAction                          Action = 8
	GenerateDataKeyAction                 Action = 9
	GenerateDataKeyWithoutPlaintextAction Action = 10
	ExportDataKeyAction                   Action = 11
	GetPublicKeyAction                    Action = 12
	GetVersionAction                      Action = 13
	EnrollAction                          Action = 14
	GenerateQuoteAction                   Action = 15
	VerifyQuoteAction                     Action = 16
	GenHmacAction                         Action = 17
)

type Action int8

func (a Action) Call(payload any, resp RespIfc) error {
	if payload == nil {
		payload = map[string]any{}
	}
	req := map[string]any{
		"action":  int8(a),
		"payload": payload,
	}
	return EHsmCallResult(req, resp)
}
